<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Node() {
            this.n = "node"
        }

        function ELement() {
            this.e = "element"
            Node.call(this)
        }

        // 标签都是HTMLElement对象
        function IHTMLElElement() {
            this.name = "htmlELement"
            ELement.call(this)
        }


        //body 标签
        function IHTMLBodyELement() {
            //call 继承
            IHTMLElElement.call(this);
            this.name = "body";
        }

        //input 标签
        function HTMLInuptElement() {

        }

        function Location() {
            this.hash = "#后面的"
            this.host = "域名"
            this.href = "全url"
            this.origin = "协议+域名"
            this.port = "端口"
            this.protocal = "协议" // file: http: https: ssh: telnet: 


            //刷新页面
            this.reload = () => {

            }

            this.replace = () => {

            }

        }

        function IDocument() {

            let name = "xiuhu"

            this.uri = "www.baidu.com";

            this.domain = "www.baidu.com"

            this.all = [];

            this.title = "文档标题"

            this.getElementById = function() {};

            this.getElementByName = function() {};

            this.getElementByTagName = function() {};

            this.querySelector = () => {}

            this.getRootNode = function() {};

            this.getName = () => {
                return name;
            }

            this.body = new IHTMLBodyELement();

            this.location = "new";

        }

        function IWindow() {
            this.document = new IDocument();
        }

        const iwindow = new IWindow();

        console.log(iwindow.document.body.name);
    </script>

</body>

</html>